package com.aidex.web.controller.system;

import com.aidex.common.core.domain.AjaxResult;
import com.aidex.common.core.domain.model.LoginUser;
import com.aidex.framework.web.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author su
 * @Date 2023/5/8 16:39
 */
@RestController
@RequestMapping("/mobile")
public class IndexController {

    @Autowired
    private TokenService tokenService;

    @GetMapping("/index")
    @ResponseBody
    public AjaxResult index(HttpServletRequest request) {
        boolean loginCheck = Boolean.parseBoolean(request.getParameter("loginCheck"));
        if (loginCheck) {
            if (tokenService.getLoginUser(request) == null) {
                return AjaxResult.error("");
            }
        }
        return AjaxResult.success("");
    }

}
